<template>
  <div class=''>
    <!-- 面包屑导航区域 -->
    <Bootstrap v-bind:BootstrapTitle="BootstrapTitle"></Bootstrap>
    <!-- 卡片内容区域 -->
    <el-card>
      <el-table :data="powerList" style="width: 100%" stripe border>
        <el-table-column type="index" label="" width="50">
        </el-table-column>
        <el-table-column prop="authName" label="权限名称" >
        </el-table-column>
        <el-table-column prop="path" label="路径" >
        </el-table-column>
        <el-table-column prop="level" label="权限等级">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.level === '0'">一级权限</el-tag>
            <el-tag type="success" v-else-if="scope.row.level === '1'">二级权限</el-tag>
            <el-tag type="danger" v-else="scopr.row.level === '2'">三级权限</el-tag>
          </template>
        </el-table-column>
      </el-table>

    </el-card>
  </div>
</template>
<script>
import Bootstrap from "../../component/component/Bootstrap";
export default {
  components: {
    Bootstrap,
  },
  name: "",
  data() {
    return {
      BootstrapTitle: {
        first: "权限管理",
        second: "/rights",
        third: "权限列表",
      },
      powerList: [],
    };
  },
  created() {
    this.getPowerList();
  },
  methods: {
    // 获取权限列表
    async getPowerList() {
      let res = await this.$http.get("rights/list");
      console.log(res);
      if (res.data.meta.status !== 200) {
        this.$message.error("获取权限列表失败");
      } else {
        this.powerList = res.data.data;
        this.$message.success("获取权限列表成功");
      }
    },
  },
};
</script>
<style lang='less' scoped>
.el-tag{
  margin: 7px;

}
</style>